﻿@model List<Galaxy.Entities.Menu>
@{ 
    List<Galaxy.Entities.Menu> folds = Model.Where(q => q.MenuType == 0).OrderBy(q => q.LevelCode).ToList();
}
<ul class="sidebar-menu" data-widget="tree">
    @foreach (var menu in folds)
    {
        var isActive = ViewBag.CurrentMenu == menu.Code; //判断当前功能是否处于激活
        <li class="treeview">
            <a href="#">
                <i class='@menu.MenuIcon'></i>
                <span>@menu.Name</span>
                <span class="pull-right-container">
                    <i class="fa fa-angle-left pull-right"></i>
                </span>
            </a>
            <ul class="treeview-menu">
                @{ 
                    List<Galaxy.Entities.Menu> files = Model.Where(q => q.MenuType == 1 && q.ParentNodeId == menu.Id).OrderBy(q => q.LevelCode).ToList();
                }
                @foreach (var file in files)
                {
                    <li><a href='@Url.Content(file.URL)'><i class='@file.MenuIcon'></i> @file.Name</a></li>
                }
            </ul>
        </li>
    }
    <li class="treeview">
        <a href="#">
            <i class="fa fa-th"></i>
            <span>系统管理</span>
            <span class="pull-right-container">
                <i class="fa fa-angle-left pull-right"></i>
            </span>
        </a>
        <ul class="treeview-menu">
            <li><a href='@Url.Content("~/Users/Index")'><i class="fa fa-user"></i> 用户管理</a></li>
            <li><a href="@Url.Content("~/Menu/Index")"><i class="fa fa-cogs"></i> 菜单管理</a></li>
            <li><a href='@Url.Content("~/Roles/Index")'><i class="fa fa-user-plus"></i> 角色管理</a></li>
            <li><a href='@Url.Content("~/Organization/Index")'><i class="fa fa-server"></i> 组织管理</a></li>
            <li><a href='@Url.Content("~/Permission/Index")'><i class="fa fa-lock"></i> 角色授权</a></li>
            @*<li><a href="#"><i class="fa fa-book"></i> 字典管理</a></li>*@
            <li><a href='@Url.Content("~/swagger/")' target="_blank"><i class="fa fa-book"></i> 系统Api</a></li>
        </ul>
    </li>
</ul>